package app.backend.controller;

import app.backend.common.CommonResult;
import app.backend.entity.BizCarousel;
import app.backend.service.BizCarouselService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 轮播图信息表 控制器
 *
 * @author 程开磊
 * @date  2025/09/06 14:31
 */
@Slf4j
@RestController
@RequestMapping("/carousel")
@Tag(name = "轮播图管理", description = "轮播图相关接口")
public class BizCarouselController {

    @Resource
    private BizCarouselService bizCarouselService;

    /**
     * 获取开启状态的轮播图列表，按排序字段升序排序
     *
     * @return 轮播图列表
     */
    @GetMapping("/list")
    @Operation(summary = "获取轮播图列表", description = "获取开启状态的轮播图列表，按排序字段升序排序")
    public CommonResult<List<BizCarousel>> getCarouselList() {
        List<BizCarousel> carouselList = bizCarouselService.getEnabledCarousels();
        return CommonResult.data(carouselList);
    }
}
